<%-- 
    Document   : halamanPubKaryaIlmiah
    Created on : Oct 16, 2012, 1:17:04 PM
    Author     : user
--%>

<%@page import="java.util.List"%>
<%@page import="java.util.List"%>
<%@page import="Entity.Penelitian"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<!DOCTYPE html>
<%@include file="../header.jsp"%>
<script>
    function validateForm()
    {						
        if(document.frm.tahunMulai.value=="" && document.frm.tahunAkhir.value!="")
        {                                                
            document.getElementById("periode_error").innerHTML="<font size='2' color='red'><i>&nbsp;Periode awal belum terisi.</i></font>";
            return false;
        } else if(document.frm.tahunMulai.value!="" && document.frm.tahunAkhir.value=="")
        {                                                
            document.getElementById("periode_error").innerHTML="<font size='2' color='red'><i>&nbsp;Periode akhir belum terisi.</i></font>";
            return false;
        } else if(document.frm.tahunMulai.value > document.frm.tahunAkhir.value)
        {
            document.getElementById("periode_error").innerHTML="<font size='2' color='red'><i>&nbsp;Periode awal harus lebih kecil dari periode akhir.</i></font>";
            return false;
        }
    }
</script>
<!-- start content-outer ........................................................................................................................START -->
<div id="content-outer">
    <!-- start content -->
    <div id="content">

        <!--  start page-heading -->
        <div id="page-heading">
            <h1>Laporan Rekapitulasi Publikasi HaKI</h1>
        </div>
        <!-- end page-heading -->

        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tr>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                <th class="topleft"></th>
                <td id="tbl-border-top">&nbsp;</td>
                <th class="topright"></th>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
            </tr>

            <tr>
                <td id="tbl-border-left"></td>
                <td>
                    <!--  start content-table-inner ...................................................................... START -->
                    <div id="content-table-inner">
                        <%
                            ArrayList listRole2 = new ArrayList();
                            listRole2 = (ArrayList) session.getAttribute("role");
                            int count2;
                            String role2;

                        %>
                        <!--  start table-content  -->


                        <div id="table-content">
                            <table border="0" width="100%" cellpadding="100" cellspacing="0">                               
                                <form id="mainform" action="laporanPublikasiHaki" method="POST" onsubmit="return validateForm()" name="frm">
                                    <input class="inp-form" type="hidden" name="cari" value="true"/>
                                    <tbody>
                                        <tr>
                                            <th width="289" align="left" valign="middle" colspan="6"><u>Fasilitas Pencarian :</u><input class="inp-form" type="hidden" name="cari" value="true"/></th>
                                    </tr>
                                    <tr>
                                        <td colspan="6">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <th>Judul Paten HaKI</th>
                                        <td valign="middle" align="center">:</td>
                                        <td>
                                            <input class="inp-form" type="text" name="judul" value="${judul}" />
                                        </td>
                                        <td>&nbsp;</td>

                                        <th>Dosen Pemilik Karya</th>
                                        <td valign="middle" align="center">:</td>
                                        <td>
                                            <select name="pemilikKarya" id="pemilikKarya" class="styledselect_form_1">
                                                <option value="">Seluruh Dosen</option>
                                                <c:forEach items="${dosen}" var="dosen">
                                                    <option value="${dosen.user.idUser}"
                                                            <c:if test="${(dosen.user.idUser == pemilikKarya)}">                
                                                                selected="selected"
                                                            </c:if>
                                                            >${dosen.user.namaUser}</option>
                                                </c:forEach>
                                            </select>
                                        </td>
                                        <td>&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                        <td valign="top"><font size="1"><i>&nbsp;</i></font></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td valign="top"><font size="1"><i>&nbsp;</i></font></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <th>Status Kemajuan</th>
                                        <td valign="middle" align="center">:</td>
                                        <td>
                                            <select name="statusKemajuan" id="statusKemajuan" class="styledselect_form_1">
                                                <option value="">- Pilih Status Kemajuan -</option>
                                                <option value="Terdaftar" 
                                                        <c:if test="${(statusKemajuan == 'Terdaftar')}">                
                                                            selected="selected"
                                                        </c:if>
                                                        >- Terdaftar -</option>
                                                <option value="Mendapatkan Sertifikat"
                                                        <c:if test="${(statusKemajuan == 'Mendapatkan Sertifikat')}">                
                                                            selected="selected"
                                                        </c:if>
                                                        >- Mendapatkan Sertifikat -</option>
                                            </select>
                                        </td>
                                        <td>&nbsp;</td>

                                        <th>Rentang Tahun</th>
                                        <td valign="middle" align="center">:</td>
                                        <td>
                                            <select id="tahunMulai" name="tahunMulai" class="styledselect_form_1">
                                                <option value=""                                                        
                                                        <%
                                                            String periodeMulai = (String) request.getAttribute("tahunMulai");
                                                            if (periodeMulai.equals("")) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        >Seluruh Periode</option>
                                                <%
                                                    Calendar c = Calendar.getInstance();
                                                    c.setTime(new Date());
                                                    //String d = + "-"+c.MONTH+"-"+c.DATE;
                                                    int tahun = c.get(Calendar.YEAR);
                                                    for (int i = 0; i < 10; i++) {
                                                %>
                                                <option value="<% out.print(tahun);%>"                                                         
                                                        <% if (periodeMulai.equals("" + tahun)) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        ><% out.print(tahun);%></option>
                                                <%
                                                        tahun--;
                                                    }%>

                                            </select></td><td align ="center" valign="middle"> s.d. </td><td align ="center" valign="middle"><select  id="tahunAkhir" name="tahunAkhir" class="styledselect_form_1">
                                                <option value=""                                                        
                                                        <%
                                                            String periodeSelesai = (String) request.getAttribute("tahunSelesai");
                                                            if (periodeSelesai.equals("")) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        >Seluruh Periode</option>
                                                <%
                                                    Calendar d = Calendar.getInstance();
                                                    d.setTime(new Date());
                                                    //String d = + "-"+c.MONTH+"-"+c.DATE;
                                                    int periodeAkhir = d.get(Calendar.YEAR);
                                                    for (int i = 0; i < 10; i++) {
                                                %>
                                                <option value="<% out.print(periodeAkhir);%>"                                                         
                                                        <%
                                                                if (periodeSelesai.equals("" + periodeAkhir)) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        ><% out.print(periodeAkhir);%></option>
                                                <%
                                                        periodeAkhir--;
                                                    }%>
                                            </select>
                                        </td>
                                        <td>&nbsp;</td>

                                        <th>Tampilkan dalam bentuk</th>
                                        <td valign="middle" align="center">:</td>
                                        <td>
                                            <select name="jenisTampil" id="jenisTampil" class="styledselect_form_1">
                                                <option value="1" 
                                                        <c:if test="${(jenisCetak == '1')}">                
                                                            selected="selected"
                                                        </c:if>
                                                        >Tampilkan di Halaman Web</option>
                                                <option value="2"
                                                        <c:if test="${(jenisCetak == '2')}">                
                                                            selected="selected"
                                                        </c:if>
                                                        >Cetak di Laporan Excel</option>                                                
                                            </select>
                                        </td>
                                        <td>&nbsp;</td>

                                        <th>&nbsp;</th>
                                        <td valign="top">&nbsp;</td>
                                        <td valign="top"><input value="" class="form-tampilkan" type="submit" /></input></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                        <td valign="top"><font size="1"><i>&nbsp;</i></font></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td colspan="3" id="periode_error" valign="middle"></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td valign="top"><font size="1"><i>&nbsp;</i></font></td>                                            
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    </tbody>
                                </form>
                            </table>

                            <SCRIPT TYPE="text/javascript">
                                <!--
                                function popup(mylink, windowname)
                                {
                                    if (! window.focus)return true;
                                    var href;
                                    if (typeof(mylink) == 'string')
                                        href=mylink;
                                    else
                                        href=mylink.href;
                                    window.open(href, windowname, 'width=1000,height=550,scrollbars=yes');
                                    return false;
                                }
                                //-->
                            </SCRIPT>		 		

                            <!--  start product-table ..................................................................................... -->
                            <form id="mainform" action="">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                                    <tr>
                                        <th class="table-header-repeat line-left"><a href="">No.</a>
                                        <th class="table-header-repeat line-left"><a href="#">Judul Karya</a>	</th>
                                        <th class="table-header-repeat line-left minwidth-1"><a href="#">Nama-nama Dosen</a></th>
                                        <th class="table-header-repeat line-left minwidth-1"><a href="#">Nomor Paten</a></th>
                                        <th class="table-header-repeat line-left minwidth-1"><a href="#">Tanggal Pendaftaran Paten</a></th>
                                        <th class="table-header-repeat line-left minwidth-1"><a href="#">Status Kemajuan</a></th>
                                        <th class="table-header-options line-left"><a href="">Pilihan</a></th>
                                    </tr>
                                    <c:if test="${empty listHaki}" >
                                        <tr>
                                            <td colspan="8" align="center" bordercolor="#FF0000" bgcolor="#FF0000"><strong>Data Publikasi HaKI Tidak Ada</strong>
                                            </td>
                                        </tr>   
                                    </c:if>
                                    <%
                                        int i = 1;
                                    %>                  
                                    <c:forEach items="${listHaki}" var="haki">
                                        <tr 
                                            <% if (i % 2 == 0) {
                                                    out.println("class='alternate-row'");
                                                }%>
                                            >
                                            <td align="center">
                                                <%
                                                    out.print(i);
                                                    i++;
                                                %>
                                            </td>
                                            <td>${haki.judulPatenHaki}</td>
                                            <td>${haki.dosen}</td>
                                            <td>${haki.noPaten}</td>
                                            <td>
                                                <fmt:parseDate value="${haki.tanggalPendaftaranPaten}" var="parsedTanggalPaten" pattern="yyyy-MM-dd" />
                                                <fmt:formatDate type="date" dateStyle="long" value="${parsedTanggalPaten}"/>
                                            </td>
                                            <td>${haki.statusKemajuan}</td>                                       
                                            <td class="options-width">
                                                <a href="detailLaporanHaki?noHaki=${haki.idKaryaHaki}" title="Preview">[Detail]</a>
                                            </td>
                                        </tr>

                                    </c:forEach>


                                </table>
                                <!--  end product-table................................... --> 
                            </form>
                        </div>
                        <!--  end content-table  -->

                        <!--  start paging..................................................... -->
                        <table border="0" cellpadding="0" cellspacing="0" id="paging-table">
                            <tr>
                                <td>
                                    <a href="" class="page-far-left"></a>
                                    <a href="" class="page-left"></a>
                                    <div id="page-info">Halaman <strong>1</strong> / 15</div>
                                    <a href="" class="page-right"></a>
                                    <a href="" class="page-far-right"></a>
                                </td>
                                <td>
                                    <select  class="styledselect_pages">
                                        <option value="">Jumlah baris</option>
                                        <option value="">1</option>
                                        <option value="">2</option>
                                        <option value="">3</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                        <!--  end paging................ -->

                        <div class="clear"></div>

                    </div>
                    <!--  end content-table-inner ............................................END  -->
                </td>
                <td id="tbl-border-right"></td>
            </tr>
            <tr>
                <th class="sized bottomleft"></th>
                <td id="tbl-border-bottom">&nbsp;</td>
                <th class="sized bottomright"></th>
            </tr>
        </table>
        <div class="clear">&nbsp;</div>

    </div>
    <!--  end content -->
    <div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>
<%@include file="../footer.jsp"%>
